package eraikikon2;

import java.awt.BorderLayout;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import java.awt.GridLayout;
import java.awt.Dimension;
import java.awt.Rectangle;

public class IdentifikatuGui extends JFrame {

	private static final long serialVersionUID = 1L;
	private IdentifikatuGui ig = null;
	private JPanel jContentPane = null;
private IdentifikatuKud idKud = new IdentifikatuKud();  //  @jve:decl-index=0:
	/**
	 * This is the default constructor
	 */
	public IdentifikatuGui() {
		super();
		ig = this;
		initialize();
		Box box = Box.createHorizontalBox();
		Box box1 = Box.createVerticalBox();
		Box box2 = Box.createVerticalBox();
		JLabel jLabel = new JLabel();
		JLabel jLabel1 = new JLabel();
		final JTextField jTextField = new JTextField();
		final JPasswordField jPassword = new JPasswordField();
		JButton jButton = new JButton();
		box1.add(jLabel);
		box1.add(jLabel1);
		box2.add(jTextField);
		box2.add(jPassword);
		box.add(box1);
		box.add(box2);
		box.add(jButton);
		jLabel.setText("                 Izena:   ");
		jLabel1.setText("         Pasahitza:   ");
		jButton.setText("Identifikatu");
		jContentPane.add(box,BorderLayout.NORTH );
				jButton.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent e) {
					if (idKud.getMota(jTextField.getText(), jPassword.getText()).compareTo("administratzailea")==0){
						AdminSegurGui asg = new AdminSegurGui();
						asg.setVisible(true);
						ig.setVisible(false);
					}if (idKud.getMota(jTextField.getText(), jPassword.getText()).compareTo("arduraduna")==0){
						AdminSegurGui asg = new AdminSegurGui();
						asg.setVisible(true);
						ig.setVisible(false);
					}else if (idKud.getMota(jTextField.getText(), jPassword.getText()).compareTo("null")==0)
					JOptionPane.showMessageDialog(null, "ez duzu baimenik");
						
					}
				});
			}
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(376, 106);
		this.setMaximumSize(new Dimension(376, 106));
		this.setContentPane(getJContentPane());
		this.setTitle("JFrame");
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			
		}
		return jContentPane;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
